<%- include('../layouts/head.ejs', { pageConf })%>

<%- include('../common/user_nav.ejs', { commonPageConf })%>

<div class="recom-container">
  <!-- 题目部分 -->
  <div class="problem-wrap">
    <div class="list-title">
      <h2><%= pageConf.problem_wrap_title%></h2>
    </div>
    <div class="refresh-wrap">
      <a class="btn btn-refresh js-fresh-btn">刷新每日题目</a>
    </div>
    <table class="layui-table">
      <!-- <colgroup>
      <col width="">
      <col width="">
      <col>
    </colgroup> -->
      <thead>
        <tr>
          <% pageConf.problem_head.forEach((item, index) => { %>
          <th class="problem-th"><%= item %></th>
          <% }) %>
        </tr>
      </thead>
      <tbody class="js-problem-container">

        <% problemList.forEach((item, index) => { %>
        <tr>
          <td class="problem-td">
            <a href="/problem-detail/<%= item.pid%>" target="_blank" rel="noopener noreferrer">
              <%= item.pid %>
            </a>
          </td>
          <td class="problem-td">
            <a href="/problem-detail/<%= item.pid%>" target="_blank" rel="noopener noreferrer">
              <%= item.title %>
            </a>
          </td>
          <td class="problem-td"><%= item.type %></td>
          <td class="problem-td"><%= item.difficulty %></td>
          <td class="problem-td"><%= item.submit_times %></td>
          <td class="problem-td"><%= item.submit_times === 0 ? '50' : item.pass_times / item.submit_times * 100 %>%</td>
        </tr>
        <% }) %>
      </tbody>
    </table>
  </div>

  <!-- 错题列表 -->
  <div class="problem-wrap">
    <div class="list-title">
      <h2>错题列表</h2>
    </div>
    <table class="layui-table">
      <thead>
        <tr>
          <% pageConf.problem_head.forEach((item, index) => { %>
          <th class="problem-th"><%= item %></th>
          <% }) %>
        </tr>
      </thead>
      <tbody class="js-problem-container">

        <% errProblemList.forEach((item, index) => { %>
        <tr>
          <td class="problem-td">
            <a href="/problem-detail/<%= item.pid%>" target="_blank" rel="noopener noreferrer">
              <%= item.pid %>
            </a>
          </td>
          <td class="problem-td">
            <a href="/problem-detail/<%= item.pid%>" target="_blank" rel="noopener noreferrer">
              <%= item.title %>
            </a>
          </td>
          <td class="problem-td"><%= item.type %></td>
          <td class="problem-td"><%= item.difficulty %></td>
          <td class="problem-td"><%= item.submit_times %></td>
          <td class="problem-td"><%= item.submit_times === 0 ? '50' : item.pass_times / item.submit_times * 100 %>%</td>
        </tr>
        <% }) %>
      </tbody>
    </table>
  </div>
</div>



<%- include('../layouts/foot.ejs', { pageConf })%>